<template>
  <div>
    <div class="newsContainer">
      <h2>{{newinf.title}}</h2>
      <div class="pinglun">
        <span>发表时间:{{newinf.add_time|dateFormat()}}</span>
        <span>点击:{{newinf.click}}次</span>
      </div>
      <hr />
      <div class="content" v-html="newinf.content">
      </div>
        <comentbox></comentbox>
    </div>
  </div>
</template>
<script>
import { Toast } from "mint-ui";
import comment from '../subcomponments/commont.vue'

export default {
  data() {
    return {
      id: this.$route.params.id,
      newinf:{}
    };
  },
  created(){
      this.getxiangqing();
  },
  methods: {
    getxiangqing() {
      this.$http
        .get('http://www.liulongbin.top:3005/api/getnew/'+this.id)
        .then(result => {
          if (result.body.status == 0) {
                    this.newinf = result.body.message[0];
          } else {
            Toast("内容加载不出来");
          }
        });
    }
  },
  components:{
            "comentbox":comment
        }
};
</script>
<style>
   .newsContainer h2{
      font-size: 20px;
      color:red;
      text-align: center
   }
   .pinglun{
       color: blue;
       font-size: 14px;
       display:flex;
       justify-content: space-between
   }
   .newsContainer{
       padding: 10px;
   }
</style>
